package com.Lgwd.controller.userController;

import com.Lgwd.dao.BackDao;
import com.Lgwd.entity.UserItemInfoEntity;
import com.Lgwd.service.backService.UserItemInfoService;
import com.Lgwd.utils.ResponseData;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Slf4j
@RestController
@CrossOrigin
public class UserItemInfoController {

    @Autowired
    UserItemInfoService userItemInfoService;

    /**
     * 获取单个物品属性
     * @param backDao
     * @return
     */
    @RequestMapping("/getItemInfo")
    public ResponseData getItemInfo(@RequestBody BackDao backDao){
        UserItemInfoEntity backInfoEntity=userItemInfoService.findItemInfoByItemId(backDao);
        if(backInfoEntity==null){
            return ResponseData.defaultFail("未获取到物品信息");
        }
        return ResponseData.defaultSuccess(backInfoEntity);
    }
}
